import Route from '../kernel/route/route'
declare var global:{
    gem_Route:any;
    controller:any;
}

if(module) module.exports = controller;
//控制器的表示注解，用来生成控制器
export default async function controller(ctx,prefix:string){

    global.gem_Route = new Route({
        id          :   ctx.module.id,
        prefix      :   prefix || "",
        middleware  :   []
    });

    //清空
    global.controller={};
    //调用路由
    global.controller[ctx.module.id] = {prefix:prefix || (prefix==="/" ? "" : prefix)};
}